package com.zzt.zt_lifecycle;

import android.util.Log;

import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;

/**
 * @author: zeting
 * @date: 2022/12/19
 */
public class MLifecycleV1 implements LifecycleObserver {
    private static final String TAG = "Lifecycle  MLifecycleV1";

    @OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
    public void create() {
        Log.d(TAG, "观察者调用了 Lifecycle.Event.ON_CREATE 方法");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_START)
    public void start() {
        Log.d(TAG, "观察者调用了 Lifecycle.Event.ON_START 方法");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
    public void resume() {
        Log.d(TAG, "观察者调用了 Lifecycle.Event.ON_RESUME 方法");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
    public void pause() {
        Log.d(TAG, "观察者调用了 Lifecycle.Event.ON_PAUSE 方法");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
    public void stop() {
        Log.d(TAG, "观察者调用了 Lifecycle.Event.ON_STOP 方法");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
    public void destry() {
        Log.d(TAG, "观察者调用了 Lifecycle.Event.ON_DESTROY 方法");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_ANY)
    public void anyMethod() {
        Log.d(TAG, "观察者调用了 Lifecycle.Event.ON_ANY 方法");
    }
}
